'''
将分数与评级的位置相对应，从而bisect返回的位置信息成为了索引
但这个索引是否太慢呢，二分查找logN应该还行
'''
import bisect


def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'):
    i = bisect.bisect(breakpoints, score)
    return grades[i]


if __name__ == '__main__':
    list = [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]
    print(list)
